data ficticious_watch_orders; input Date:date9. ID $ Price; format date date9.; datalines; 01NOV2012 10003 1150 01NOV2012 12022 3150 01NOV2012 10004 1565 02NOV2012 11011 1655 02NOV2012 11012 2325 03NOV2012 12021 2590 03NOV2012 12022 3150 03NOV2012 12023 4300 03NOV2012 12024 3250 04NOV2012 10001 1345 04NOV2012 10002 1289 04NOV2012 10003 1150 05NOV2012 12022 3150 05NOV2012 10004 1565 06NOV2012 11011 1655 06NOV2012 11012 2325 06NOV2012 10001 1345 06NOV2012 10002 1289 06NOV2012 12021 2590 07NOV2012 12022 3150 07NOV2012 12023 4300 07NOV2012 12025 4560 ; run; data ficticious_brands; input ID Name:$20.; datalines; 10 Tagline 11 Roladex 12 Brett ; run; data ficticious_styles; input ID Name $4-25; datalines; 1 Man About Town 2 Big Gold Face 3 Moons Abound 4 Aqua Proof 11 Prince Someone 12 Princess 13 Not Your Dads Watch 21 One Time Zone 22 Two Time Zones 23 Three Time Zones 24 Four Time Zones 25 Five Time Zones ; run; data Watch_Sales; set ficticious_watch_orders; array man{10:12} $20 _temporary_ ('Tagline','Roladex','Brett'); M_ID=input(substr(ID,1,2),2.); Manufacturer=man{M_ID}; run; data Watch_Sales; set ficticious_watch_orders; array man{10:12} $20 _temporary_; if _N_=1 then do i=1 to NumObs; set ficticious_brands(rename=(ID=B_ID)) nobs=NumObs; man{B_ID}=Name; end; M_ID=input(substr(ID,1,2),2.); Manufacturer=man{M_ID}; run; data Watch_Sales; set ficticious_watch_orders; array man{10:12} $20 _temporary_; array style{25} $35 _temporary_; if _N_=1 then do i=1 to NumObs; set ficticious_brands(rename=(ID=B_ID)) nobs=NumObs; man{B_ID}=Name; end; if _N_=1 then do i=1 to Num; set ficticious_styles(rename=(ID=S_ID)) nobs=Num; style{S_ID}=Name; end; M_ID=input(substr(ID,1,2),2.); St_ID=input(substr(ID,length(ID)-1),2.); Manufacturer=man{M_ID}; Style_Name=style{St_ID}; run; data sales; input Date:date9. Style1 - Style5; format Date date9.; datalines; 31JAN2012 129800 149800 171336 152024 1042 29FEB2012 282400 31400 372768 354912 4089 31MAR2012 68700 75570 90840 86156 9387 30APR2012 127200 13200 167900 151136 1333 31MAY2012 544000 584000 718800 62720 7754 30JUN2012 96000 105300 127160 117044 1728 31JUL2012 37000 38700 45840 41226 4943 31AUG2012 43980 43780 58536 52248 6267 30SEP2012 77600 85600 102430 92178 1166 31OCT2012 151400 166400 199980 179972 2928 30NOV2012 39000 42000 51480 46330 5554 31DEC2012 90000 99400 11980 10739 8742 ; run; data target; input Year M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 M12; datalines; 2009 2 3 2 4 3 2 1 1 1 2 2 1 2010 3 5 3 6 5 4 3 3 3 3 4 3 2011 3 6 4 7 2 5 2 4 4 4 5 4 2012 5 5 3 6 4 6 4 2 5 6 6 5 ; run; proc transpose data=target(where=(year=2012)) out=target_T(rename=(col1=Target)) name=Mon; run; data target_T_mon; set target_T; where Target ne 2012; Month=input(substr(Mon,2),2.); run; data sales_sum(sortedby=Month); set sales; Month=month(Date); Total=sum(of Style:); run; data compare_; keep Date Style1-Style5 Total Target Difference; merge sales_sum target_T_mon; by Month; Difference=Total-(Target*1000000); run; data compare; keep Date Style1-Style5 Total Target Difference; array mon{*} Month1-Month12; if _N_=1 then set target (where=(Year=2012)); set sales; Total=sum(of Style:); Month=month(Date); Target=mon{Month}*1000000; Difference=Total-Target; run; data wchill; input WSpeed Neg10 Neg5 Tmp0 Tmp5 Tmp10 Tmp15 Tmp20 Tmp25 Tmp30; datalines; 5 -22 -16 -11 -5 1 7 13 19 25 10 -28 -22 -16 -10 -4 3 9 15 21 15 -32 -26 -19 -13 -7 0 6 13 19 20 -35 -29 -22 -15 -9 -2 4 11 17 25 -37 -31 -24 -17 -11 -4 3 9 16 30 -39 -33 -26 -19 -12 -5 1 8 15 35 -41 -34 -27 -21 -14 -7 0 7 14 40 -43 -36 -29 -22 -15 -8 -1 6 13 ; run; data temps; input Date:date9. High Low Wind; format Date date9.; datalines; 29AUG2012 8 0 14 30AUG2012 7 -2 22 31AUG2012 9 -1 20 1SEP2012 8 0 23 2SEP2012 9 1 19 3SEP2012 10 2 14 4SEP2012 12 3 16 5SEP2012 10 2 23 6SEP2012 12 0 12 ; run; data wndchll(keep=Date Wind High Low HighChill LowChill); array WC{8,9} _Temporary_; array farenheit{*} High Low HighChill LowChill; if _n_=1 then do I=1 to 8; set wchill; array Tmp{9} Neg10 -- Tmp30; do J=1 to 9; WC{I,J}= Tmp{J}; end; end; set temps; Row=round(Wind,5)/5; Column1=(round(High,5)/5)+3; Column2=(round(Low,5)/5)+3; HighChill=round(WC{Row,Column1}); LowChill=round(WC{Row,Column2}); do i=1 to dim(Farenheit); Farenheit{i}=9/5*Farenheit{i}+32; end; run;